
#pragma once

#include <aclapi.h>
//#include "Processthreadsapi.h"

#define THREADS_API __declspec(dllexport)


typedef struct _IN_THREAD
{
	LPVOID		p_class_thread;
	//SOCKET	    p_socket;
	DWORD       p_id;
} IN_THREAD, *LPIN_THREAD;


class THREADS_API CThread
{
private:
	SECURITY_DESCRIPTOR   *secDescr;
	SECURITY_ATTRIBUTES   *secAttr;
	SIZE_T                stackSize;
	PTHREAD_START_ROUTINE *routine;
	void                  *parameteres;
	DWORD                 flags;
	DWORD				  threadID;
	HANDLE				  threadHandle;

	PSID pEveryoneSID = NULL, pAdminSID = NULL;
	PACL pACL = NULL;
	PSECURITY_DESCRIPTOR pSD = NULL;

	EXPLICIT_ACCESS *pea;

	SID_IDENTIFIER_AUTHORITY SIDAuthWorld;
	SID_IDENTIFIER_AUTHORITY SIDAuthNT;

	void createDescriptor();

protected:

	static void comm_routine(LPVOID);
public:
	CThread();
	~CThread();
	virtual void mainroutine(LPVOID);
};

